package thread.threadpoolpackage;


import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author didi
 */
public class ScheduleThreadPool {
    public static ScheduledExecutorService ThreadPool() {
        ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10);
        return scheduledExecutorService;
    }

    public static void main(String[] args) {

        ScheduledExecutorService threadPool = ThreadPool();

        System.out.println("time:" + System.currentTimeMillis());
        threadPool.schedule(
            new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getThreadGroup() + "--" + Thread.currentThread().getId() +
                        "--" + Thread.currentThread().getName());
                }
            },
            5,
            TimeUnit.SECONDS);
    }
}